<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('contract_details', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('user_id')->index()->default(0);
            $table->unsignedBigInteger('project_id')->index()->default(0);
            $table->unsignedBigInteger('contract_id')->index()->default(0);
            $table->string('name')->nullable()->comment('项目名称');
            $table->string('content')->nullable()->comment('施工内容');
            $table->string('unit')->nullable()->comment('单位');
            $table->unsignedBigInteger('work_quantity')->default(0)->comment('工程量');
            $table->decimal('unit_price',10,2)->default(0)->comment('单价');
            $table->decimal('price',10,2)->default(0)->comment('合价');
            $table->string('remarks')->nullable()->comment('备注');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('contract_details');
    }
};
